package com.tx.trtccloud.controller;

import com.alibaba.fastjson.JSONObject;
import com.tx.trtccloud.service.CloudRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
public class CloudRecordingController {

    @Autowired
    CloudRecordService recordService;

    @RequestMapping("/record/start")
    public String start(String body) {
        JSONObject json = JSONObject.parseObject(body);
        return recordService.startRecord(json);
    }

    @RequestMapping("/record/update")
    public String update(String body) {
        JSONObject json = JSONObject.parseObject(body);
        return recordService.updateLayout(json);
    }

    @RequestMapping("/record/stop")
    public String stop(String body) {
        JSONObject json = JSONObject.parseObject(body);
        return recordService.stopRecord(json);
    }

    @RequestMapping("/record/state")
    public String state(String body) {
        JSONObject json = JSONObject.parseObject(body);
        return recordService.queryRecordingState(json);
    }

}
